#include <vector>
#include <iostream>
 
int diagonalSum(std::vector<std::vector<int>>& mat) {
    int sum = 0;
    int n = mat.size();
    for(int i = 0; i < n; i++) {
        sum += mat[i][i] + mat[i][n - 1 - i];
    }
    if(n % 2 == 1) {
        sum -= mat[n / 2][n / 2];
    }
    return sum;
}
 
int main() {
    std::vector<std::vector<int>> mat1 = {{1,2,3}, {4,5,6}, {7,8,9}};
    std::cout << diagonalSum(mat1) << std::endl; // Output: 25
    return 0;
}